package com.hb.core.pojo.project.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hb.core.pojo.project.order.dto.UserOrderDTO;
import com.hb.core.pojo.project.order.dto.UserOrderGoodsDTO;
import com.hb.core.pojo.project.order.entity.UserOrder;
import com.hb.core.pojo.project.order.vo.UserOrderExportListVO;
import com.hb.core.pojo.project.section.dto.BidSectionDTO;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 订单信息 Mapper 接口
 * </p>
 *
 * @author zhaojk
 * @since 2021-08-30
 */
public interface UserOrderMapper extends BaseMapper<UserOrder> {

    /**
     * 分页查询购买文件列表
     *
     * @param userOrder
     * @return
     */
    Page<UserOrderDTO> pagePurchaseFile(@Param("page") Page<UserOrderDTO> page, @Param("userOrder") UserOrderDTO userOrder);

    /**
     * 分页查询订单管理页面
     *
     * @param userOrder
     * @return
     */
    List<UserOrderDTO> findOrderManagementList(@Param("page") Page<UserOrderDTO> pages, @Param("userOrder") UserOrderDTO userOrder);

    /**
     * 查询文件下载列表
     *
     * @param userOrder
     * @return
     */
    List<UserOrderDTO> findFileDownloadList(@Param("page") Page<UserOrderDTO> page, @Param("userOrder") UserOrderDTO userOrder);

    /**
     * 查询指定项目下的费用审核信息
     *
     * @param sectionId
     * @param feeType
     * @return
     */
    Page<UserOrderDTO> feeManagers(Page<UserOrderDTO> pages, Long sectionId, Integer feeType);

    /**
     * 费用管理统计列表
     * 该方法只统计支付成功的数量
     *
     * @param sectionDTO
     * @return
     */
    Page<UserOrderDTO> feeStatistics(Page<UserOrderDTO> pages, BidSectionDTO sectionDTO);

    /**
     * 查询指定条件的订单列表
     *
     * @param goodsDTO
     * @return
     */
    Page<UserOrderDTO> pageWithGoodInfo(Page<UserOrderDTO> pages, UserOrderGoodsDTO goodsDTO);

    /**
     * 查询指定投标人企业下的费用缴纳状态
     *
     * @param userOrderGoodsDTO#sectionId                标段ID
     * @param userOrderGoodsDTO#feeType                  费用类型
     * @param userOrderGoodsDTO#userOrderDTO#orderStatus 订单状态
     * @return
     */
    UserOrder queryUserOrder(UserOrderGoodsDTO userOrderGoodsDTO);

    /**
     *
     * @Description:查询标段订单费用类型
     * @Author: zhongdl
     * @Date:2022/3/1 13:36
     * @param sectionId:
     * @param feeType:
     * @param orgId:
     * @return: {@link List< UserOrderDTO> }
     **/
    List<UserOrderDTO> listUserOrderByFreeType(@Param("sectionId") Long sectionId, @Param("feeType") Integer feeType, @Param("orgId") Long orgId);


    /**
     * 查询项目下的订单信息
     * @author tian
     * @date 2022-3-3 9:59
     * @param userOrderGoodsDTO
     * @return java.util.List<com.hb.core.pojo.project.order.dto.UserOrderDTO>
     */
    Page<UserOrderDTO> selectOrderInfoByProjectId(Page<UserOrderDTO> pages, UserOrderGoodsDTO userOrderGoodsDTO);

    /**
     * 查询成功订单列表
     *
     * @author yuezheng
     * @param pages
     * @param userOrderDTO
     * @return Page<UserOrderDTO>
     * @date 2022/4/13 7:13 PM
     */
    Page<UserOrderDTO> selectOrderSuccessList(@Param("page") Page pages, @Param("userOrderDTO") UserOrderDTO userOrderDTO);

    /**
     * 统计本月成交额
     *
     * @author yuezheng
     * @param
     * @return java.math.BigDecimal
     * @date 2022/4/14 10:07 AM
     */
    BigDecimal countByOrderAmountToMonth(@Param("userOrderDTO") UserOrderDTO userOrderDTO);

    /**
     * 统计本月成交数
     *
     * @author yuezheng
     * @param
     * @return int
     * @date 2022/4/14 10:12 AM
     */
    Integer countOrderByToMonth(@Param("userOrderDTO") UserOrderDTO userOrderDTO);

    /**
     * 查询导出数据
     *
     * @author yuezheng
     * @param userOrderDTO
     * @return java.util.List<com.hb.core.pojo.project.order.dto.UserOrderGoodsDTO>
     * @date 2022/4/14 2:37 PM
     */
    List<UserOrderExportListVO> selectExportOrderGoods(@Param("userOrderDTO") UserOrderDTO userOrderDTO);
}
